#region License

// This file is part of Grawlix.
// 
// Grawlix is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
// Grawlix is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public
// License along with Grawlix.  If not, see
// <http://www.gnu.org/licenses/>.

#endregion

using System;

namespace Grawlix.Services
{
	/// <summary>
	/// A factory service for resources.
	/// </summary>
	/// <typeparam name="T">The type of resource the factory
	/// creates.</typeparam>
	public interface IDynamicResourceFactory<T>
		where T : IDynamicResource

	{
		/// <summary>
		/// Starts the reloading of a given resource, to be swapped in
		/// when complete.
		/// </summary>
		/// <param name="resource">The resource to reload.</param>
		void Reload(T resource);

		/// <summary>
		/// Finds or creates a resource.
		/// </summary>
		/// <param name="identifier">The identifier of the resource.
		/// </param>
		/// <returns>The resource, which may not be ready.
		/// </returns>
		T Resolve(Uri identifier);

		/// <summary>
		/// Updates all the resources in the factory.
		/// </summary>
		/// <param name="elapsed">The amount of time since last update.
		/// </param>
		void Update(TimeSpan elapsed);
	}
}